﻿<!DOCTYPE html>
<!--安全管理师培训管理-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta itemScore="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

</head>

<body>
    
<div id="app" v-cloak>   
        <el-form label-position="right" :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="100px"
            size="mini">
            <el-row>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.trainMain" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{SafetyManagerTraining.trainMain+mark.m}}
                                </template>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.trainMain.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>

                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11" :offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.local" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{SafetyManagerTraining.local+mark.m}}
                                </template>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.local.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </el-form-item>
                    </div>
                </el-col>

                <el-col :span="11">
                    <el-form-item>
                        <div class="elst-select-mini">
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{SafetyManagerTraining.trainTime+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.trainTime" type="date" size="mini"
                                                format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                                </el-date-picker>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.trainTime.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </div>
                    </el-form-item>
                </el-col>
                <el-col :span="11" :offset="2">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{"是否合格"+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.isQualified" slot="suffix"
                                               placeholder="请选择">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in IsQualified" :label="item.value" :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
            </el-row>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <!-- <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button> -->
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
                </el-row>
            </el-form>
        </div>
        <script type="text/javascript">
            var app = new Vue({
                el: '#app',
                data: {
                    id: '',
                    type: '',
                    //业务表单内容
                    Form: {
                        zbSafetyTrainerId:'',
                        local: "",
                        trainMain: "",
                        trainTime:'',

                    },
                    IsQualified: [{ key: '合格', value: '合格' }, { key: '不合格', value: '不合格' }],
                    //表单验证
                    rules: {


                    }
                },
                methods: {
                    //解決edge下select bug
                    visibleChange: function (isVisible) {
                        visibleChange(isVisible)
                    },
                    handleChange: function (value) {
                        console.log(value);
                    },
                    //提交数据
                    onSubmitForm: function (formitemScore) {
                        var mythis = this;
                        this.$refs[formitemScore].validate(function (valid) {
                            //验证通过
                            if (valid) {
                                if (mythis.Form.trainMain == null || mythis.Form.trainMain == "" || mythis.Form.trainMain == undefined) {
                                    alert('请输入培训内容');
                                    return false;
                                }

                                if (mythis.Form.local == null || mythis.Form.local == "" || mythis.Form.local == undefined) {
                                    alert('请输入培训地点');
                                    return false;
                                }

                                if (mythis.Form.trainTime == null || mythis.Form.trainTime == "" || mythis.Form.trainTime == undefined) {
                                    alert('请选择培训时间');
                                    return false;
                                }

                                if (mythis.Form.isQualified == null || mythis.Form.isQualified == "" || mythis.Form.isQualified == undefined) {
                                    alert('请选择是否合格');
                                    return false;
                                }
                                onSubmitForm(this, '/api/ZB_SafetyTrainerDetail/Save', mythis.Form);
                            } else {
                                //验证失败
                                return false;
                            }
                        });
                    },
                    getData: function () {
                        getData(this, '/api/ZB_SafetyTrainerDetail/get?id=' + this.id);
                    },
                },
                mounted: function () {
                    //this.IsConsumables = getDicData('50');
                    this.id = getUrlParam("id");
                    this.type = getUrlParam("type");
                    if (this.type != 'tj') {
                        this.getData();
                    } else {
                        //this.Form.id = this.id;
                        this.Form.zbSafetyTrainerId = this.id;
                    }
                }
            });
        </script>
    </body>

    </html>
